<?php
// ----------------------------------------------------------------------------
//
//  File: poll_option_add.php   
//  Creation Date:  06/09/11
//  Last Modified:  13/09/11
//  Purpose: 添加投票选项
//
// ----------------------------------------------------------------------------
require_once("action/sys_conf.inc");

if(isset($_GET[sid])){
	$sid = $_GET[sid];
}
if(isset($_GET[oid])){

	$id = $_GET[oid];
	$link_id = mysql_connect($DBHOST,$DBUSER,$DBPWD);
	mysql_select_db($DBNAME);
	mysql_query("SET NAMES 'utf8'");
	$sql = "select id,subjectId,name,introduction from extpollitems where id='$id'";
	$result = mysql_query($sql);
	$option = mysql_fetch_assoc($result);
	$id = $option['id'];
	$sid = $option['subjectId'];
	$name = $option['name'];
	$name = $option['name'];
	$introduction = $option['introduction'];
	echo '
	<script language="javascript" type="text/javascript">
		$(document).ready(function(){
			$("#pollMediaAdd").load("poll_media.php?oid='.$id.'");
		});
	</script>';
}
?>
	
</head>
<body>
<h1>添加投票选项</h1>
<form action="action/pollOptionAdd.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="option[subid]" value="<?php echo $sid ?>" />
<input type="hidden" name="option[id]" value="<?php echo $id ?>" />
<div class="from-row">
	<label class="required">名称：</label>
	<div class="content"><input type="text" name="option[name]" value="<?php echo $name ?>"/></div>
</div>
<div class="from-row">
	<label class="required">文字介绍：</label>
	<div class="content"><textarea cols="50" rows="10" name="option[introduction]"><?php echo $introduction ?></textarea></div>
</div>
<div class="from-row">
	<label class="required">图片或视频：</label>
	<?php if($id) { ?><div class="content"><a href="javascript:void(0)" rel="poll_media_add.php?oid=<?php echo $id ?>" onClick="javascript:iframe(2,$(this).attr('rel'))">添加</a></div>
</div>
<span id="pollMediaAdd"></span><?php }else{ ?>请先保存<?php } ?>
<div class="from-row">
	<input name="submitPoll" type="submit" value="提交" />
	<input name="cancel" type="button" value="取消" onClick="javascript:$('#iframe1').hide();" />
</div>
</form>

